//
//  MineWebViewController.swift
//  HLSwiftWork
//
//  Created by hulinhu on 2018/6/13.
//  Copyright © 2018年 hulinhu. All rights reserved.
//

import UIKit
import WebKit

class MineWebViewController: UIViewController {

    var urlString: String!
    var btnTitle = ""
    var webView :WKWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = btnTitle
        guard let url = URL(string: urlString) else {
            return
        }
        webView = WKWebView.init(frame: CGRect(x: 0, y: kTopHeight, width: kScreenWidth, height: kScreenHeight-kTopHeight))
        webView.navigationDelegate = self
        webView.load(URLRequest(url: url))
        webView.scrollView.showsVerticalScrollIndicator = false
        view.addSubview(webView)
    }
}

extension MineWebViewController: WKNavigationDelegate {
    func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
        print("网络请求失败")
    }
    
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        print("网络数据加载完毕")
    }
}

